package com.sixth.controller;

import com.sixth.entity.Shaftchoose;
import com.sixth.service.ShaftChooseService;
import com.sixth.util.CommonResult;
import com.sixth.util.TableLayUi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: project01
 * @description:
 * @author: 老魏
 * @create: 2021-12-23 20:11
 **/
@RestController
@RequestMapping("/shaftchoose")
public class ShaftChooseController {
   @Autowired
    private ShaftChooseService shaftChooseService;

   @RequestMapping("/findAllShaftChoose")
    public  CommonResult findAllShaftChoose(){
       CommonResult commonResult =shaftChooseService.findAllShaftChoose();
       return  commonResult;
   }
   @RequestMapping("/deleteShaftChoose")
   public  CommonResult deleteShaftChoose(Integer shaftchooseid){
       return  shaftChooseService.deleteShaftChoose(shaftchooseid);
   }
   @RequestMapping("/addOrUpdateShaftChoose")
    public CommonResult addOrUpdateShaftChoose(Shaftchoose shaftchoose){
       if(shaftchoose.getShaftchooseid()!=null){
           return  shaftChooseService.updateShaftchoose(shaftchoose);
       }else {
           return  shaftChooseService.addShaftchoose(shaftchoose);
       }
   }
    @RequestMapping("/listByCondition")
    public TableLayUi listByCondition(int page, int limit ){
        return  shaftChooseService.findshaftCondition(page,limit);
    }
}
